﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace CreaMotion.ValueConverters
{
	public class FieldItem2String : IValueConverter
	{
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            String ReturnData = string.Empty;

            try
            {
                ReturnData = ((UserControls.FieldItem)value).Source.FieldName;
            }
            catch { }

            return ReturnData;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            //String ReturnData = string.Empty;

            //try
            //{
            //    ReturnData = ((UserControls.FieldItem)value).Source.FieldName;
            //}
            //catch { }

            return value;
        }
    }
}